package cn.tkd.client.gold.context;

import com.google.gwt.user.client.DOM;

public class TkdSystemContext {

    public static boolean isExtnedTime;
    public static boolean isFromWeb;
    public static boolean isDoingExpress;

    public static void initSystemContext() {
        isExtnedTime = isExtendTime();
        isFromWeb = isFromWeb();
        isDoingExpress = isDoingExpress();
    }

    private static boolean isExtendTime() {
        String value = DOM.getElementById("isAPIExtendTime").getAttribute("value");
        if ("false".equalsIgnoreCase(value)) {
            return true;
        }
        return false;
    }

    private static boolean isFromWeb() {
        String value = DOM.getElementById("isFromWeb").getAttribute("value");
        if ("false".equalsIgnoreCase(value)) {
            return false;
        }
        return true;
    }

    private static boolean isDoingExpress() {
        String value = DOM.getElementById("doing_express").getAttribute("value");
        if ("doing_express".equalsIgnoreCase(value)) {
            return true;
        }
        return false;
    }
}
